#ifndef CH_EDITVIEW_H
#define CH_EDITVIEW_H

#pragma once

class CHEditCtrl;

class CHEditFindDlg : public CFindReplaceDialog
{
friend class CHEditView;

	virtual ~CHEditFindDlg ();

protected:
	CHEditView* m_pParent;
};

/////////////////////////////////////////////////////////////////////////////
// CHEditView view

class CHEditView : public CView
{
	friend class CHEditFindDlg;

protected:
	DECLARE_DYNCREATE(CHEditView)
	CHEditView();           // protected constructor used by dynamic creation

// Attributes
public:
	CHEditCtrl* GetEditCtrl () const
	{
		return m_pWndEditCtrl;
	}

protected:
	CHEditCtrl*		m_pWndEditCtrl;
	CHEditFindDlg*	m_pFindDlg;

	static CString		m_strFindText;
	static DWORD		m_dwFindMask;

// Operations
public:
	void SerializeRaw(CArchive& ar);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CHEditView)
	public:
	virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL

	virtual BOOL FindText (const CString& strFind, DWORD dwFindMask);
	virtual void OnTextNotFound (LPCTSTR /*lpszFind*/) {}

// Implementation
protected:
	virtual ~CHEditView();

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	virtual CHEditCtrl* CreateEdit ();

	// Generated message map functions
protected:
	//{{AFX_MSG(CHEditView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg void OnDestroy();
	//}}AFX_MSG
	afx_msg void OnFilePrintPreview();
	afx_msg void OnEditPreviousbookmark();
	afx_msg void OnEditCut();
	afx_msg void OnEditCopy();
	afx_msg void OnEditPaste();
	afx_msg void OnEditSelectAll();
	afx_msg void OnUpdateEditCut(CCmdUI* pCmdUI);
	afx_msg void OnUpdateEditCopy(CCmdUI* pCmdUI);
	afx_msg void OnEditRedo();
	afx_msg void OnUpdateEditRedo(CCmdUI* pCmdUI);
	afx_msg void OnEditUndo();
	afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
	afx_msg void OnEditFind();
	afx_msg LONG OnFindReplace(WPARAM wParam, LPARAM lParam);
	afx_msg LONG OnEditChange(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

extern UINT WM_FINDREPLACE;

/////////////////////////////////////////////////////////////////////////////

#endif //CH_EDITVIEW_H
